#{extends 'main.html' /}

#{set title:'Liste Candidatures'  /}

    <div class="post">
        <h2 class="post-title">
			#{if candidatures.size != 0}
            	Liste des candidatures en attente de validation d'annulation
        </h2>
        <br>
			#{form @validationAnnulation()}

			<table width="200" cellspacing='0' cellpadding='7' id="liste" class="display" summary="Liste des candidats" bgcolor="#E1EEF0">
				<thead>
					<tr>
					    <th>Stage</th>
					    <th>Code</th>
						<th>Nom</th>
						<th>Prénom</th>
						<th>Statut</th>
						<th>CIS ou Service</th>
					 	<th>Structure de coordination</th> 
						<th>Annuler la candidature ?</th>
					</tr>
				</thead>
		        #{list items:candidatures, as:'candidature' }				
    		       	<tr>
    		       	    <td>${candidature.stage.intitule}</td>
    		       	    <td>${candidature.stage.code}</td>
    		           	<td>${candidature.agent.nom}</td>
       		           	<td>${candidature.agent.prenom}</td>
    				   	<td>${candidature.agent.statut}</td>
    				   	<td>${candidature.agent.cisService} </td>
    				   	<td>${candidature.agent.structureCoord}</td>
    				   	<td>
    				   	        Oui<input type="radio" name="validation_${candidature.id}" id="validation_${candidature.id}" value="oui" onmousedown="this.__chk = this.checked" onclick="if (this.__chk) this.checked = false" />
    				   	        Non<input type="radio" name="validation_${candidature.id}" id="validation_${candidature.id}" value="non" onmousedown="this.__chk = this.checked" onclick="if (this.__chk) this.checked = false" />
    				   	</td>
    		       	</tr>  
		        #{/list}
			</table>
			<br />
			<input type="submit" value="Valider" style="float:right;"/>
			<input type="hidden" value="${id}" name="id" />
		#{/form}
		#{/if}
		#{else}
			Aucune candidatures en attente de validation d'annulation
		#{/else}
    </div>
	<script TYPE="text/javascript">
	function testBox(id){
		if(document.getElementById("O"+id).checked && document.getElementById("N"+id).checked){
			window.alert("Veuillez choisir UNE action par candidature.");
			document.getElementById("O"+id).checked=false;
			document.getElementById("N"+id).checked=false;
		}
		if(document.getElementById("N"+id).checked){
			document.getElementById("R"+id).disabled=false;
		}
		else{
			document.getElementById("R"+id).disabled=true;
			document.getElementById("R"+id).value="";
		}
	}
	</script>